<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title></title>

    <link rel="stylesheet" th:href="@{/res/css/amazeui.min.css}">
    <link rel="stylesheet" th:href="@{/res/css/admin.css}">
    <link rel="stylesheet" th:href="@{/res/css/app.css}">
    <script type="text/javascript" th:src="@{/js/jquery-1.11.3.min.js}"></script>
    <style>
        .admin-main {
            padding-top: 0px;
        }

        #btconfirm{
            position: relative;
            top:0px;
            left:25px;
        }

        #btcancel{
            position: relative;
            top:0px;
            left:75px;
        }
    </style>
</head>

<body>
<div class="am-cf admin-main">
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-g">
                <form class="am-form am-form-horizontal" action="role/addroleSubmit.action" method="post"
                      style="padding-top: 20px;">
                    <div class="am-form-group">
                        <label class="am-u-sm-3 am-form-label">
                            参数主键
                        </label>
                        <div class="am-u-sm-9">
                            <input id="pk" required="" placeholder="请输入参数主键" value="" type="text">
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-sm-3 am-form-label">
                            参数值
                        </label>
                        <div class="am-u-sm-9">
                            <input id="pv" required="" placeholder="请输入参数值" value="" type="text">
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-sm-3 am-form-label">
                            参数说明
                        </label>
                        <div class="am-u-sm-9">
                            <input id="pd" required="" placeholder="请输入参数说明" value="" type="text">
                        </div>
                    </div>

                    <div class="am-form-group">
                        <div class="am-u-sm-9 am-u-sm-push-3">
                            <input class="am-btn am-btn-default am-btn-secondary" value="确认" type="button" onclick="confirm()" id="btconfirm">
                            <input class="am-btn am-btn-default am-btn-secondary" value="取消" type="button" onclick="cancel()" id="btcancel">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    //确认，新增数据字典
    function confirm() {
        var pk=document.getElementById("pk").value;
        var pv=document.getElementById("pv").value;
        var pd=document.getElementById("pd").value;
        $.ajax({
            type: 'post',
            url: '/parameter/add',
            data: {pk:pk,pv:pv,pd:pd},
            dataType: 'text',
            success: function (mydata) {
                alert(mydata);
            },
            error: function () {
                alert("请求失败");
            }
        });
        close();
    }

    //取消，返回上一页
    function cancel() {
        close();
    }

    //关闭当前页面
    function close() {
        window.parent.location.reload();
    }
</script>
</html>
